import { request } from '@/request/request.js'

// 获取登录验证码
export function getVerifyCode(query) {
  return request('/captcha/sent', query)
}

// 登录
export function login(query) {
  return request('/login/cellphone', query)
}

// 二维码登录流程：生成key => 根据key生成二维码 => 轮询获取二维码接口状态
// 二维码生成key
export function getQrCodeKey() {
  return request('/login/qr/key')
}

// 生成二维码
export function getQrCode(query) {
  return request('/login/qr/create', query)
}

// 获取二维码状态
export function checkQrCode(query) {
  return request('/login/qr/check', query)
}

// 获取账号信息
export function getAccountInfo() {
  return request('/user/account')
}
// 注册---------------------------------------------

// 检测手机号是否注册过
export const testMobileIsRegister = (params) =>
  request('/cellphone/existence/check', params)

// 注册发送验证码
export const registerGetCode = (params) => request('/captcha/sent', params)

// 提交注册验证码
export const submitRegisterCode = (params) => request('/captcha/verify', params)

// 完成注册，设置用户昵称
export const registerOver = (params) => request('/register/cellphone', params)

// 获取用户音乐列表
export const getUserMusicList = (params) => request('/user/playlist', params)
